package com.heima.user.controller.v1;

import com.heima.user.service.AdUserService;
import com.heima.model.common.dtos.admin.AdminLoginDto;
import com.heima.model.common.dtos.common.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * admin端登录接口
 */
@Api(value = "/login", tags = {"admin端登录接口"})
@RestController
@RequestMapping("/login")
public class AdUserLoginController {
    @Autowired
    private AdUserService adUserService;

    /**
     * admin端登录功能实现
     * @param dto
     * @return
     */
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "body", dataType = "AdminLoginDto", name = "dto", value = "", required = true)
    })
    @ApiOperation(value = "admin端登录功能实现", notes = "admin端登录功能实现", httpMethod = "POST")
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdminLoginDto dto) {
        return adUserService.login(dto);
    }

}
